package com.hk.service.yingmi.impl;

import com.hk.service.yingmi.IYingmiResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class YingmiResultCodeImpl  implements IYingmiResultCode {

	private Logger logger = LoggerFactory.getLogger(YingmiResultCodeImpl.class);

	@Autowired
	private JdbcTemplate jdbcTemplate;

	/**
	 * 通过code获取codeMsg
	 * @param code
	 * @return
	 */
	@Override
	public String getCodeMsg(String code) {
		String msg = null;
		if(code != null) {
			try {
				msg = (String) jdbcTemplate.queryForObject( "SELECT codeMsg FROM t_ym_resultCode WHERE code = ?", new Object[] {code}, java.lang.String.class);
				return msg;
			} catch (Exception e) {
				logger.error("code error = ", e);
			}
		}

		return msg;
	}

}
